

import java.util.*;



public class ReservationSystem {
    private ArrayList<Request> requests;


    public ReservationSystem() {
        requests = new ArrayList<Request>();
    }

    public void addRequest(Request request){
        requests.add(request);
    }
   
    public ArrayList<Request> getRequests(){
        return requests;
    }
    

    public ArrayList<String> getRequests(String check){
        String[] split = check.split("/");
		GregorianCalendar gc = new GregorianCalendar(Integer.parseInt(split[2]),
                Integer.parseInt(split[0])-1,
                Integer.parseInt(split[1]));
		ArrayList<String> list = new ArrayList<String>();
		for(Request detail: this.getRequests()){
			if(gc.equals(detail.getDate())){
				list.add(detail.info());
			}
		}
		return list;
	}
    
    public ArrayList<String> getRequests(String fromdate, int fromtime,
			String todate, int totime){
			String[] splitF = fromdate.split("/");
			String[] splitT = todate.split("/");
			int fM = Integer.parseInt(splitF[0]);
			int fD = Integer.parseInt(splitF[1]);
			int fY = Integer.parseInt(splitF[2]);
			int tM = Integer.parseInt(splitT[0]);
			int tD = Integer.parseInt(splitT[1]);
			int tY = Integer.parseInt(splitT[2]);
			GregorianCalendar fgc = new GregorianCalendar(fY, fM-1, fD);
			GregorianCalendar tgc = new GregorianCalendar(tY, tM-1, tD);
		ArrayList<String> list = new ArrayList<String>();
		for(Request detail: this.getRequests()){
			if(detail.getDate().after(fgc) && detail.getDate().before(tgc)){
				list.add(detail.info());
			}
		}
		return list;
	}
   
    
}
